package com.zjb.demo.system.domain;

import com.alibaba.excel.annotation.ExcelProperty;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import com.mybatisflex.core.keygen.KeyGenerators;
import com.zjb.demo.common.listener.BaseOnListener;
import com.zjb.demo.common.domain.dto.BaseEntity;
import com.zjb.demo.framework.converter.YseOrNoConverter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.noear.solon.validation.annotation.NotBlank;
import org.noear.solon.validation.annotation.Size;

import java.io.Serial;

/**
 * SysConfig对象
 *
 * @author 庄佳彬
 * @since 2023/12/27 13:52
 */
@Table(value = "sys_config", onInsert = BaseOnListener.class, onUpdate = BaseOnListener.class)
@ApiModel(value = "SysConfig对象")
public class SysConfig extends BaseEntity {
    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 参数主键
     */
    @Column(value = "config_id")
    @ExcelProperty(value = "参数主键")
    @ApiModelProperty(value = "参数主键")
    @Id(keyType = KeyType.Generator, value = KeyGenerators.flexId)
    private Long configId;

    /**
     * 参数名称
     */
    @Column(value = "config_name")
    @ExcelProperty(value = "参数名称")
    @ApiModelProperty(value = "参数名称")
    @Size(max = 500, message = "参数键值长度不能超过500个字符")
    private String configName;

    /**
     * 参数键名
     */
    @Column(value = "config_key")
    @ExcelProperty(value = "参数键名")
    @ApiModelProperty(value = "参数键名")
    @Size(max = 100, message = "参数名称不能超过100个字符")
    private String configKey;

    /**
     * 参数键值
     */
    @Column(value = "config_value")
    @ExcelProperty(value = "参数键值")
    @ApiModelProperty(value = "参数键值")
    private String configValue;

    /**
     * 系统内置（Y是 N否）
     */
    @Column(value = "config_type")
    @ExcelProperty(value = "系统内置", converter = YseOrNoConverter.class)
    @ApiModelProperty(value = "系统内置（Y是 N否）")
    private String configType;

    public Long getConfigId() {
        return configId;
    }

    public void setConfigId(Long configId) {
        this.configId = configId;
    }

    @NotBlank(message = "参数名称不能为空")
    public String getConfigName() {
        return configName;
    }

    public void setConfigName(String configName) {
        this.configName = configName;
    }

    @NotBlank(message = "参数键名长度不能为空")
    public String getConfigKey() {
        return configKey;
    }

    public void setConfigKey(String configKey) {
        this.configKey = configKey;
    }

    @NotBlank(message = "参数键值不能为空")
    public String getConfigValue() {
        return configValue;
    }

    public void setConfigValue(String configValue) {
        this.configValue = configValue;
    }

    public String getConfigType() {
        return configType;
    }

    public void setConfigType(String configType) {
        this.configType = configType;
    }

    @Override
    public String toString() {
        return "SysConfig{" +
                "configId=" + configId +
                ", configName='" + configName + '\'' +
                ", configKey='" + configKey + '\'' +
                ", configValue='" + configValue + '\'' +
                ", configType='" + configType + '\'' +
                '}';
    }
}
